<template>
  <!-- 基础曲线定义页面 -->
  <div>
    <el-row class="baceCurveDefinition container">
      <el-col style="margin-right:10px;" class="content-left">
        <el-row class="handleBox">
          <el-col :span="18">
            <el-button type="primary" @click="addFunc()">新增</el-button>
            <el-button @click="editFunc()">编辑</el-button>
            <el-button @click="delFunc()">删除</el-button>
          </el-col>
          <el-col :span="6">
            <div class="handleIconBox">
              <i class="iconfont icon-export" title="导出"></i>
              <i class="iconfont icon-import" title="导入"></i>
              <el-popover
                placement="left-start"
                trigger="click"
                popper-class="icon_porper"
              >
                <div class="search_porper">
                  <el-form
                    :model="searchForm"
                    ref="searchForm"
                    label-width="100px"
                    label-position="right"
                    size="mini"
                  >
                    <el-form-item label="币种编码：">
                      <el-input
                        v-model="searchForm.currencyCode"
                        style="width:150px"
                      ></el-input>
                    </el-form-item>
                    <el-form-item label="币种名称：" prop="treeTypeName">
                      <el-input
                        v-model="searchForm.currencyName"
                        style="width:150px"
                      ></el-input>
                    </el-form-item>
                  </el-form>
                  <div style="text-align:center;padding:10px">
                    <el-button type="primary" size="mini">查询</el-button>
                    <el-button
                      size="mini"
                      @click="
                        (searchForm.currencyCode = ''),
                          (searchForm.currencyName = '')
                      "
                      >重置</el-button
                    >
                  </div>
                </div>
                <i
                  class="iconfont icon-sousuo"
                  title="搜索"
                  slot="reference"
                ></i>
              </el-popover>
              <el-popover
                placement="bottom"
                width="150"
                trigger="click"
                popper-class="icon_porper"
              >
                <div class="operation_checkbox">
                  <el-checkbox-group v-model="checkList">
                    <el-checkbox
                      v-for="item in textData"
                      :label="item.label"
                      :key="item.prop"
                      >{{ item.label }}
                    </el-checkbox>
                  </el-checkbox-group>
                </div>
                <i
                  class="iconfont icon-liebiaoshezhi"
                  title="列表设置"
                  slot="reference"
                ></i>
              </el-popover>
            </div>
          </el-col>
        </el-row>
        <el-table
          ref="multipleTable"
          :data="tableData"
          style="width: 100%"
          @row-click="authorizeFor"
        >
          <el-table-column
            width="55"
            type="selection"
            fixed="left"
          ></el-table-column>
          <el-table-column prop="curveCode" label="编号" v-if="columnState[0]">
          </el-table-column>
          <el-table-column prop="curveName" label="名称 " v-if="columnState[1]">
          </el-table-column>
          <el-table-column
            prop="dimCurrency.currencyName"
            label="币种编号 "
            v-if="columnState[2]"
          >
          </el-table-column>
          <el-table-column
            prop="termStructDef.structureName"
            label="期限结构 "
            v-if="columnState[3]"
          >
          </el-table-column>
          <el-table-column
            prop="accruBasis"
            label="计息基础代码 "
            v-if="columnState[4]"
          >
          </el-table-column>
          <el-table-column
            prop="interpolationFlag"
            label="是否插值 "
            v-if="columnState[5]"
            :formatter="row => (row.currencyFlag == 1 ? '是' : '否')"
          >
          </el-table-column>
          <el-table-column
            prop="interpolationWay"
            label="插值方式"
            v-if="columnState[6]"
          >
          </el-table-column>
          <el-table-column
            prop="affirmFre"
            label="确认频率 "
            v-if="columnState[7]"
          >
          </el-table-column>
          <el-table-column prop="creator" label="创建人" v-if="columnState[8]">
          </el-table-column>
          <el-table-column
            prop="createdTm"
            label="创建时间"
            sortable
            v-if="columnState[9]"
            :formatter="row => timeFormat(row.createdTm)"
          >
          </el-table-column>
          <el-table-column
            prop="modifier"
            label="修改人"
            v-if="columnState[10]"
          >
          </el-table-column>
          <el-table-column
            prop="modifiedTm"
            label="修改时间"
            sortable
            v-if="columnState[11]"
            :formatter="row => timeFormat(row.modifiedTm)"
          >
          </el-table-column>
        </el-table>
        <pagination
          @size-change="sizeChange"
          @current-change="pageChange"
          @refresh="searchFunc"
          :current="searchForm.page"
          :total="total"
        ></pagination>
      </el-col>
    </el-row>
    <el-dialog
      v-dialogDrag
      :title="saveTitles[saveFlg - 1]"
      :visible.sync="addOrEdit"
      width="35%"
    >
      <el-form
        :model="saveForm"
        ref="saveForm"
        label-width="110px"
        label-position="left"
        :rules="saveFormRules"
      >
        <el-row>
          <el-col :span="24">
            <el-form-item label="曲线编号:" prop="curveCode" required>
              <el-input
                v-model="saveForm.curveCode"
                maxlength="40"
                :disabled="saveFlg == 2"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="曲线名称:" prop="curveName" required>
              <el-input
                v-model="saveForm.curveName"
                maxlength="40"
              ></el-input>
            </el-form-item>
          </el-col>
               <el-col :span="12">
            <el-form-item label="确认频率:" prop="affirmFre" required>
              <el-select
                v-model="saveForm.affirmFre"
                placeholder="请选择"
                style="width:138px"
              >
                <el-option
                  v-for="item in affirmFreLsit"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="币种:" prop="currencyCode" required>
              <el-select
                v-model="saveForm.currencyCode"
                placeholder="请选择"
                style="width:138px"
              >
                <el-option
                  v-for="item in ccyList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
      
          <el-col :span="24">
            <el-form-item label="是否插值:" prop="interpolationFlag"  @change="$forceUpdate()" required>
               <el-radio-group v-model="saveForm.interpolationFlag">
                 <el-radio  label="1">是</el-radio>
                 <el-radio  label="0">否</el-radio>
                </el-radio-group>
            </el-form-item>
          </el-col>
           <el-col :span="24">
            <el-form-item label="插值方式:" prop="interpolationWay" >
               <el-radio-group v-model="saveForm.interpolationWay" size="mini">
                 <el-radio :label="'1'" border >线性插值</el-radio>
                 <el-radio :label="'2'" border >左阶梯插值</el-radio>
                 <el-radio :label="'3'" border >右阶梯插值</el-radio>
                </el-radio-group>
            </el-form-item>
          </el-col>
           <el-col :span="24">
            <el-form-item label="期限结构:" prop="structureCode" required>
              <el-select
                v-model="saveForm.structureCode"
                placeholder="请选择"
                style="width:100%"
              >
                <el-option
                  v-for="item in structureList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
           <el-col :span="24">
            <el-form-item label="计息基础代码:" prop="accruBasis" required>
              <el-select
                v-model="saveForm.accruBasis"
                placeholder="请选择"
                style="width:100%"
              >
                <el-option
                  v-for="item in accruBasisList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="addOrEdit = false">确 定</el-button>
        <el-button @click="addOrEdit = false">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { publicManage } from "@/api/index";
import onlyOneSearch from "@/components/onlyOneSearch";
import moment from "moment";
export default {
  data() {
    return {
      userName: "", //右侧用户名
      addOrEdit: false, // 新增/编辑/查看弹窗
      isModuleData: false, //同步模块数据弹窗
      serachMore: false,
      isProConfig: false, //工程表配置弹窗
      saveFlg: 1, // 1:新增，2：编辑，3查看,
      saveTitles: ["添加基础定义表信息", "修改基础定义表信息"],
      // 机构树
      orgList: [
        {
          value: "01",
          label: "一级机构",
          children: [{ value: "001", label: "二级机构" }]
        }
      ],
      // 币种
      ccyList:[
        {value:"CNY",label:"人民币",},
        {value:"EUR",label:"欧元",},
        {value:"HKD",label:"港元",},
        {value:"USD",label:"美元",},
        {value:"JPY",label:"日元",},
        {value:"ZHRMB",label:"本外币合计",},
      ],
      // 确认频率list
      affirmFreLsit:[
        {value:"D",label:"日",},
        {value:"W",label:"周",},
        {value:"M",label:"月",},
        {value:"S",label:"季",},
        {value:"Y",label:"年",},

      ],
      // 期限结构
      structureList:[
        {value:"1",label:"1D/3M/6M/1Y/3Y/5Y",},
        {value:"2",label:"人民币存贷款曲线期限",},
        {value:"3",label:"人民币曲线期限",},
      ],
      // 计息基础代码
      accruBasisList:[
        {value:"0",label:"Actual/365",},
        {value:"1",label:"Actual/360",},
        {value:"2",label:"Actual/Actual",},
        {value:"3",label:"30/360",},
        {value:"4",label:"30/365",},
        {value:"5",label:"30/Actual",},
        {value:"6",label:"Actual/364",},
        {value:"7",label:"Actual/366",},
      ],
      moduleDataForm: {},
      // 右侧树data
      treeData: [
        {
          id: 1,
          label: "一级 1",
          children: [
            {
              id: 4,
              label: "二级 1-1",
              children: [
                {
                  id: 9,
                  label: "三级 1-1-1"
                },
                {
                  id: 10,
                  label: "三级 1-1-2"
                }
              ]
            }
          ]
        },
        {
          id: 2,
          label: "一级 2",
          children: [
            {
              id: 5,
              label: "二级 2-1"
            },
            {
              id: 6,
              label: "二级 2-2"
            }
          ]
        },
        {
          id: 3,
          label: "一级 3",
          children: [
            {
              id: 7,
              label: "二级 3-1"
            },
            {
              id: 8,
              label: "二级 3-2"
            }
          ]
        }
      ],
      defaultProps: {
        children: "children",
        label: "label"
      },
      // 角色管理下拉框
      mgrRoleIdList: [
        {
          value: "选项1",
          label: "模块1"
        },
        {
          value: "选项2",
          label: "模块2"
        }
      ],
      // search机构树悬停提示
      searchOrgTip: "",
      // save表单机构树悬停提示
      saveOrgTip: "",
      searchForm: {
        username: "",
        page: 1,
        size: 15
      },
      total: 0,
      saveForm: {
        curveCode:"",
        curveName:"",
        currencyCode:"",
        structureCode:"",
        accruBasis:"",
        affirmFre:"",
        interpolationFlag:"1",
        interpolationWay:"",
    
      },
      searchFF: {},
      saveFormRules: {
        userName: [
          { required: true, message: "该输入项为必输项", trigger: "blur" }
        ],
        realName: [
          { required: true, message: "该输入项为必输项", trigger: "blur" }
        ],
        password: [
          { required: true, message: "该输入项为必输项", trigger: "blur" },
          { min: 6, max: 8, message: "密码长度在6-8之间", trigger: "blur" }
          // { validator: this.validPassword, trigger: "blur" },
        ],
        passwordStr: [
          { required: true, message: "该输入项为必输项", trigger: "blur" },
          { validator: this.validPassword, trigger: "blur" }
        ],
        orgId: [
          { required: true, message: "该输入项为必输项", trigger: "blur" }
        ]
      },
      checkList: [],
      // 列隐藏
      textData: [
        { label: "编号" },
        { label: "名称 " },
        { label: "币种编号" },
        { label: "期限结构" },
        { label: "计息基础代码" },
        { label: "是否插值" },
        { label: "插值方式" },
        { label: "确认频率" },
        { label: "创建人 " },
        { label: "创建时间" },
        { label: "修改人 " },
        { label: "修改时间 " }
      ],
      // 获取table的数据
      tableData: [
        {
          creator: "sysadmin",
          createdTm: null,
          modifier: null,
          modifiedTm: null,
          curveCode: "C_AUTO_TEST",
          curveName: "AUTO收益率曲线",
          curveType: "0",
          curveDef: null,
          dimCurrency: {
            creator: "sysadmin",
            createdTm: 1557199289954,
            modifier: "sysadmin",
            modifiedTm: 1597046640933,
            status: "1",
            currencyCode: "CNY",
            currencyName: "人民币",
            currencyFlag: "1",
            currencyDescribe: null,
            currencySign: null
          },
          termStructDef: {
            creator: "sysadmin",
            createdTm: null,
            modifier: null,
            modifiedTm: null,
            structureCode: "TM_AUTO_TEST",
            structureName: "AUTO自动测试期限结构"
          },
          accruBasis: "2",
          averageFlag: null,
          averagePeriod: null,
          interpolationFlag: "1",
          interpolationWay: "3",
          spreadFlag: null,
          affirmFre: "W",
          compundingMethod: null,
          creditTate: null
        },
        {
          creator: "sys",
          createdTm: 1600996964024,
          modifier: "sys",
          modifiedTm: 1601001369276,
          curveCode: "HLzerono",
          curveName: "HL零曲线",
          curveType: "0",
          curveDef: null,
          dimCurrency: {
            creator: "sysadmin",
            createdTm: 1557199289954,
            modifier: "sysadmin",
            modifiedTm: 1597046640933,
            status: "1",
            currencyCode: "CNY",
            currencyName: "人民币",
            currencyFlag: "1",
            currencyDescribe: null,
            currencySign: null
          },
          termStructDef: {
            creator: "sys",
            createdTm: 1600996676088,
            modifier: "sys",
            modifiedTm: 1601425792633,
            structureCode: "HLzero",
            structureName: "HL零收益曲线"
          },
          accruBasis: "1",
          averageFlag: null,
          averagePeriod: null,
          interpolationFlag: "1",
          interpolationWay: "1",
          spreadFlag: null,
          affirmFre: "D",
          compundingMethod: null,
          creditTate: null
        },
        {
          creator: "sys",
          createdTm: 1597047006034,
          modifier: null,
          modifiedTm: null,
          curveCode: "10100",
          curveName: "零收益曲线",
          curveType: "0",
          curveDef: null,
          dimCurrency: {
            creator: "sysadmin",
            createdTm: 1557199289954,
            modifier: "sysadmin",
            modifiedTm: 1597046640933,
            status: "1",
            currencyCode: "CNY",
            currencyName: "人民币",
            currencyFlag: "1",
            currencyDescribe: null,
            currencySign: null
          },
          termStructDef: {
            creator: "sysadmin",
            createdTm: 1545880782000,
            modifier: "sysadmin",
            modifiedTm: 1545888535000,
            structureCode: "TC_1D",
            structureName: "期限1D"
          },
          accruBasis: "1",
          averageFlag: null,
          averagePeriod: null,
          interpolationFlag: "1",
          interpolationWay: "1",
          spreadFlag: null,
          affirmFre: "D",
          compundingMethod: null,
          creditTate: null
        },
        {
          creator: "sys",
          createdTm: 1587011153167,
          modifier: "sys",
          modifiedTm: 1596009674256,
          curveCode: "CUR_003",
          curveName: "存款靠档曲线",
          curveType: "0",
          curveDef: null,
          dimCurrency: {
            creator: "sysadmin",
            createdTm: 1557199289954,
            modifier: "sysadmin",
            modifiedTm: 1597046640933,
            status: "1",
            currencyCode: "CNY",
            currencyName: "人民币",
            currencyFlag: "1",
            currencyDescribe: null,
            currencySign: null
          },
          termStructDef: {
            creator: "sys",
            createdTm: 1586098537220,
            modifier: "sys",
            modifiedTm: 1594888839289,
            structureCode: "RMB_qxcd",
            structureName: "人民币存贷款曲线期限"
          },
          accruBasis: "2",
          averageFlag: null,
          averagePeriod: null,
          interpolationFlag: "1",
          interpolationWay: "3",
          spreadFlag: null,
          affirmFre: "S",
          compundingMethod: null,
          creditTate: null
        },
        {
          creator: "sys",
          createdTm: 1586099668218,
          modifier: "sys",
          modifiedTm: 1588830868019,
          curveCode: "CUR_002",
          curveName: "人民币存贷款曲线_T",
          curveType: "0",
          curveDef: null,
          dimCurrency: {
            creator: "sysadmin",
            createdTm: 1557199289954,
            modifier: "sysadmin",
            modifiedTm: 1597046640933,
            status: "1",
            currencyCode: "CNY",
            currencyName: "人民币",
            currencyFlag: "1",
            currencyDescribe: null,
            currencySign: null
          },
          termStructDef: {
            creator: "sys",
            createdTm: 1586098537220,
            modifier: "sys",
            modifiedTm: 1594888839289,
            structureCode: "RMB_qxcd",
            structureName: "人民币存贷款曲线期限"
          },
          accruBasis: "1",
          averageFlag: null,
          averagePeriod: null,
          interpolationFlag: "0",
          interpolationWay: null,
          spreadFlag: null,
          affirmFre: "S",
          compundingMethod: null,
          creditTate: null
        },
        {
          creator: "sys",
          createdTm: 1586099248272,
          modifier: "sys",
          modifiedTm: 1586099634374,
          curveCode: "CUR_001",
          curveName: "人民币资金市场曲线",
          curveType: "0",
          curveDef: null,
          dimCurrency: {
            creator: "sysadmin",
            createdTm: 1557199289954,
            modifier: "sysadmin",
            modifiedTm: 1597046640933,
            status: "1",
            currencyCode: "CNY",
            currencyName: "人民币",
            currencyFlag: "1",
            currencyDescribe: null,
            currencySign: null
          },
          termStructDef: {
            creator: "sys",
            createdTm: 1586098505867,
            modifier: null,
            modifiedTm: null,
            structureCode: "RMB_qx",
            structureName: "人民币曲线期限"
          },
          accruBasis: "1",
          averageFlag: null,
          averagePeriod: null,
          interpolationFlag: "1",
          interpolationWay: "1",
          spreadFlag: null,
          affirmFre: "D",
          compundingMethod: null,
          creditTate: null
        },
        {
          creator: "sysadmin",
          createdTm: 1552872215000,
          modifier: null,
          modifiedTm: null,
          curveCode: "001",
          curveName: "shibor",
          curveType: "0",
          curveDef: null,
          dimCurrency: {
            creator: "sysadmin",
            createdTm: 1557199289954,
            modifier: "sysadmin",
            modifiedTm: 1597046640933,
            status: "1",
            currencyCode: "CNY",
            currencyName: "人民币",
            currencyFlag: "1",
            currencyDescribe: null,
            currencySign: null
          },
          termStructDef: {
            creator: "sysadmin",
            createdTm: 1552872121000,
            modifier: null,
            modifiedTm: null,
            structureCode: "001",
            structureName: "SHIBOR"
          },
          accruBasis: "2",
          averageFlag: null,
          averagePeriod: null,
          interpolationFlag: "1",
          interpolationWay: "3",
          spreadFlag: null,
          affirmFre: "W",
          compundingMethod: null,
          creditTate: null
        },
        {
          creator: "sysadmin",
          createdTm: 1545891544000,
          modifier: null,
          modifiedTm: null,
          curveCode: "C_Discount",
          curveName: "人民币折现曲线",
          curveType: "0",
          curveDef: null,
          dimCurrency: {
            creator: "sysadmin",
            createdTm: 1557199289954,
            modifier: "sysadmin",
            modifiedTm: 1597046640933,
            status: "1",
            currencyCode: "CNY",
            currencyName: "人民币",
            currencyFlag: "1",
            currencyDescribe: null,
            currencySign: null
          },
          termStructDef: {
            creator: "sysadmin",
            createdTm: 1545880948000,
            modifier: "sysadmin",
            modifiedTm: 1545888495000,
            structureCode: "TC_1D_30Y",
            structureName: "期限1D至30Y"
          },
          accruBasis: "2",
          averageFlag: null,
          averagePeriod: null,
          interpolationFlag: "1",
          interpolationWay: "3",
          spreadFlag: null,
          affirmFre: "W",
          compundingMethod: null,
          creditTate: null
        },
        {
          creator: "sysadmin",
          createdTm: 1545891435000,
          modifier: null,
          modifiedTm: null,
          curveCode: "A_Zero",
          curveName: "零利率曲线",
          curveType: "0",
          curveDef: null,
          dimCurrency: {
            creator: "sysadmin",
            createdTm: 1557199289954,
            modifier: "sysadmin",
            modifiedTm: 1597046640933,
            status: "1",
            currencyCode: "CNY",
            currencyName: "人民币",
            currencyFlag: "1",
            currencyDescribe: null,
            currencySign: null
          },
          termStructDef: {
            creator: "sysadmin",
            createdTm: 1545880782000,
            modifier: "sysadmin",
            modifiedTm: 1545888535000,
            structureCode: "TC_1D",
            structureName: "期限1D"
          },
          accruBasis: "2",
          averageFlag: null,
          averagePeriod: null,
          interpolationFlag: "1",
          interpolationWay: "3",
          spreadFlag: null,
          affirmFre: "W",
          compundingMethod: null,
          creditTate: null
        },
        {
          creator: "sysadmin",
          createdTm: 1545891420000,
          modifier: null,
          modifiedTm: null,
          curveCode: "C_Bond",
          curveName: "债券基准利率",
          curveType: "0",
          curveDef: null,
          dimCurrency: {
            creator: "sysadmin",
            createdTm: 1557199289954,
            modifier: "sysadmin",
            modifiedTm: 1597046640933,
            status: "1",
            currencyCode: "CNY",
            currencyName: "人民币",
            currencyFlag: "1",
            currencyDescribe: null,
            currencySign: null
          },
          termStructDef: {
            creator: "sysadmin",
            createdTm: 1545880948000,
            modifier: "sysadmin",
            modifiedTm: 1545888495000,
            structureCode: "TC_1D_30Y",
            structureName: "期限1D至30Y"
          },
          accruBasis: "2",
          averageFlag: null,
          averagePeriod: null,
          interpolationFlag: "1",
          interpolationWay: "3",
          spreadFlag: null,
          affirmFre: "W",
          compundingMethod: null,
          creditTate: null
        }
      ]
    };
  },
  components: {
    onlyOneSearch
  },
  created() {
    this.checkListInit();
    console.log(this.tableData, "模拟数据");
  },
  computed: {
    columnState() {
      console.log(this.checkList);
      let arr = [],
        arr1 = this.textData,
        arr2 = this.checkList;
      for (let i = 0; i < arr1.length; i++) {
        let flg = false;
        for (let j = 0; j < arr2.length; j++) {
          if (arr1[i].label === arr2[j]) {
            flg = true;
          }
        }
        arr.push(flg);
      }
      return arr;
    }
  },
  mounted() {
    // this.getList();
  },
  watch: {},
  methods: {
    checkListInit() {
      this.checkList = this.textData.map(v => {
        return v.label;
      });
    },
    searchFunc(e) {
      console.log(this.searchForm, e);
    },
    addFunc() {
      this.saveFlg = 1;
      for (let k in this.saveForm) {
        this.saveForm[k] = "";
      }
      this.addOrEdit = true;
    },
    editFunc() {
      this.saveFlg = 2;
      let selection = this.$refs.multipleTable.selection;
      if (selection.length != 1) {
        return this.$message.warning("请选择一条数据进行修改");
      }
      let row = selection[0];
      let form = { ...row };
      this.saveForm.curveCode = form.curveCode;
      this.saveForm.curveName = form.curveName;
      this.saveForm.currencyCode = form.dimCurrency.currencyCode;
      this.saveForm.structureCode = form.termStructDef.structureCode;
      this.saveForm.accruBasis = form.accruBasis;
      this.saveForm.affirmFre = form.affirmFre;
      this.saveForm.interpolationFlag = form.interpolationFlag;
      this.saveForm.curveName = form.curveName;
      this.saveForm.interpolationWay = form.interpolationWay;
      console.log(this.saveForm)
      this.addOrEdit = true;
    },
    delFunc() {
      let selection = this.$refs.multipleTable.selection;
      if (selection.length < 1) {
        return this.$message.warning("请选择要删除的数据");
      }
      this.$confirm("你确定要删除选中币种吗？", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          this.$message.success("删除成功");
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除"
          });
        });
    },
    handleNodeClick() {
      let nodes = this.$refs.configTree.getCheckedNodes();
      console.log(nodes);
    },
    caliberProjectNameFormatter(row) {
      return row.caliberProject.caliberProjectName;
    },
    getList() {
      publicManage.query("我的参数").then(res => {
        console.log(res);
      });
    },
    // 点击表格右侧显示为xx授权
    authorizeFor(row) {
      if (this.$refs.multipleTable) {
        this.$refs.multipleTable.clearSelection();
      }
      this.$refs.multipleTable.toggleRowSelection(row, true);
      this.userName = row.roleName;
    },
    // 重新加载
    reload() {
      this.isModuleData = true;
    },
    timeFormat(val) {
      if (val) return moment(val).format("YYYY-MM-DD");
    },
    sizeChange(val) {
      this.searchForm.size = val;
      console.log(`每页 ${val} 条`);
    },
    pageChange(val) {
      this.searchForm.page = val;
      console.log(`当前页: ${val}`);
    }
  }
};
</script>

<style lang="scss" scoped>
.dialogSearchBox {
  header {
    text-align: center;
    span {
      margin: 0 20px;
    }
  }
}
</style>